#include<bits/stdc++.h>
using namespace std;
int n;
string a, b;
vector<bool> rec;
void solve() {
	stack<char> s;
	rec.clear();
	int i=0, len=a.size();
	bool ok = false;
	while(i<len) {
		if(s.empty()) s.push(a[i++]);
		while(s.top()!=a[i] && i<len) {
			s.push(a[i++]);
			rec.push_back(1);
		}
		if(i>=len) {ok=false; break;}
		if(s.top()==a[i]) s.pop(), i++, rec.push_back(0);
	}
	if(ok && s.empty()) {
		cout<<"Yes.\n";
		for(auto el:rec) {cout<<(el?"in\n":"out\n");}
		cout<<"FINISH\n";
	}
	else {
		cout<<"No.\nFINISH\n";
	}
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	while(cin>>n) {
		cin>>a>>b;
		solve();
	}
}
